package com.zs.toolbox.web2j.common.response;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * Created by eric.zhang on 2017/6/22.
 */
@Data
@ApiModel
public class WtBaseResponse<T> {
    @ApiModelProperty(value = "响应码", example = "0")
    public int status;

    @ApiModelProperty(value = "响应消息", example = "OK")
    public String message;

    @ApiModelProperty(value = "返回数据体", example = "")
    public T data;


    public WtBaseResponse() {
        this.status = 0;
        this.message = "ok";
    }

    public WtBaseResponse(int code, String message) {
        this.status = code;
        this.message = message;
    }

    public WtBaseResponse(int status, String message, T data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }

    public WtBaseResponse(T data) {
        this.data = data;
    }

    public String getMessage() {
        if (message == null) {
            message = "success";
        }
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
